import time,random
from selenium import webdriver
from selenium.webdriver.edge.service import Service
from selenium.webdriver.edge.options import Options
from selenium.webdriver.common.by import By

service = Service("D:\\WPS Cloud Files\\msedgedriver.exe")
opt = Options()
opt.add_argument("--disable-blink-features=AutomationControlled")

if __name__ == '__main__':

    browser = webdriver.Edge(service=service,options=opt)
    browser.get("https://www.douban.com/")
    time.sleep(3)

    # 不对！！！发现表单！！！
    # 那就定位表单，切换frame 再进行点击操作
    iframe = browser.find_element(By.XPATH,'//*[@id="anony-reg-new"]/div/div[1]/iframe')
    browser.switch_to.frame(iframe)
    browser.find_element(By.XPATH,'/html/body/div[1]/div[1]/ul[1]/li[2]').click()

    time.sleep(1.6)
    browser.find_element(By.XPATH,'//*[@id="username"]').send_keys("18811117777")
    time.sleep(2)
    browser.find_element(By.XPATH,'//*[@id="password"]').send_keys("rogeaustine")
    time.sleep(3)
    browser.find_element(By.XPATH,'/html/body/div[1]/div[2]/div[1]/div[5]/a').click()

    time.sleep(3)

    time.sleep(1111)

















